// dnSpy decompiler from Assembly-CSharp.dll class: IOUtils
using System;
using System.IO;
using UnityEngine;

public static class IOUtils
{
	public static string FileSuffixToPath(string sFileSuffix)
	{
		return string.Concat(new string[]
		{
			Application.persistentDataPath,
			"/save_",
			Application.loadedLevelName,
			sFileSuffix,
			".xml"
		});
	}

	public static bool SaveFileExists()
	{
		return IOUtils.SaveFileExists(string.Empty);
	}

	public static bool SaveFileExists(string sFileSuffix)
	{
		string path = IOUtils.FileSuffixToPath(sFileSuffix);
		return File.Exists(path);
	}

	public static void DeleteSaveFile()
	{
		IOUtils.DeleteSaveFile(string.Empty);
	}

	public static void DeleteSaveFile(string sFileSuffix)
	{
		string path = IOUtils.FileSuffixToPath(sFileSuffix);
		try
		{
			File.Delete(path);
		}
		catch (Exception ex)
		{
			UnityEngine.Debug.Log(ex.Message);
		}
	}

	public static void SaveToFile(string sData)
	{
		IOUtils.SaveToFile(sData, string.Empty);
	}

	public static void SaveToFile(string sData, string sFileSuffix)
	{
		XMLSerialization.CreateXML(IOUtils.FileSuffixToPath(sFileSuffix), sData);
	}

	public static string LoadXMLDataFromFile(string sFileSuffix)
	{
		string sPath = IOUtils.FileSuffixToPath(sFileSuffix);
		return XMLSerialization.LoadXML(sPath);
	}

	public static void RenameSaveFile(string sOldFileSuffix, string sNewFileSuffix)
	{
		string text = IOUtils.FileSuffixToPath(sOldFileSuffix);
		if (File.Exists(text))
		{
			string destFileName = IOUtils.FileSuffixToPath(sNewFileSuffix);
			File.Move(text, destFileName);
		}
	}
}
